/**复制 */
export const copyIt = async (message: string) => {
  try {
    if (!location.href.startsWith('https') && !location.origin.includes('localhost')) {return {errMsg: '必须是https打开页面'}}
    if (navigator.clipboard && navigator.clipboard.writeText) {
      await navigator.clipboard.writeText(message)
    } else {
      // 兼容
      const input = document.createElement('input')
      input.value = message
      document.body.appendChild(input)
      input.select()
      document.execCommand('Copy')
      input.style.display = 'none'
      input.remove()
    }
  } catch (error) {
    return error
  }
}
